<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>药典管理-药品查询</title>
		<link type="text/css" rel="stylesheet"
			href="${pageContext.request.contextPath}/drugUI/css/style.css" />
		<link type="text/css" rel="stylesheet"
			href="${pageContext.request.contextPath}/drugUI/css/main.css" />
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/drugUI/js/util.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/drugUI/js/jquery1.4.2.min.js"></script>
	</head>
	<body>
		<div id="container">
			<form name="Form1" method="post" id="Form1">
				<!--查询栏 开始-->
				<div class="current">
					<div class="current_con">
						<div class="help">
							<a href="#"><img
									src="${pageContext.request.contextPath}/drugUI/image/help.gif"
									title="帮助"
									onclick="showLayer('C5','${pageContext.request.contextPath}')" />
							</a>
						</div>
						<span>_当前位置：</span> 药典管理 >>药品查询
					</div>
				</div>
				<table class="table02" id="Table1" align="center" width="95%">
					<tr>
						<td class="tName" align="center" width="10%">
							药品标识符
						</td>
						<td width="40%">
							<input type="text" id="drugid" name="drugid" style="width: 80%;" />
						</td>
						<td class="tName" align="center" width="10%">
							药品名称
						</td>
						<td>
							<input type="text" id="drugname" name="drugname" style="width: 80%;" />
						</td>
					</tr>
					<tr>
						<td class="tName" align="center" width="10%">
							药品编码
						</td>
						<td width="40%">
							<input type="text" id="code" name="code" style="width: 80%;" />
						</td>
						<td class="tName" align="center" width="10%">
							药品类型
						</td>
						<td>
						<select name="typeid" id="typeid" STYLE="width: 150px">
							        <option value="">
							        全选
									</option>
									<c:forEach items="${drugTypeList}" var="p">
										<option value="${p.typeid}">
											${p.typename}
										</option>
									</c:forEach>
								</select>
						</td>
					</tr>
					<tr>
						<td class="td_bottom" align="center" colSpan="4">
							<input type="button" name="btnSearch" value="查 询"
								onClick="javascript:reflush('1');" id="btnSearch" class="btn02" />
							&nbsp;
							<input type="button" name="btnSearch" value="开处方"
								onClick="javascript:generateRecipe();" id="btnSearch" class="btn02" />
						</td>
					</tr>
				</table>
				<!--查询栏 结束-->

				<!--列表输出-->
				<div id="content">
					<div id="tabContainer">
						<!--列表输出表头-->
						<div id="tabTitle">
							<table width="100%" class="table01" align="center"
								cellspacing="0">
								<tr align="center" class="tr_title">
									<td width="5%" height="30" scope="col">
										<input id='cbSelectAll' name='cbSelectAll' type='checkbox'
											onclick="selectOrCancelBox( 'cbSelectAll', 'enplrpcds' );" />
									</td>
									<td width="15%" scope="col">
										药品名称
									</td>
									<td width="15%" scope="col">
										药品国际编码
									</td>
									<td width="15%" scope="col">
										注意事项
									</td>
									<td width="15%" scope="col">
										形状
									</td>
									<td width="15%" scope="col">
										不良反应
									</td>
									<td width="10%" scope="col">
										用法和用量
									</td>
									<td width="10%" scope="col">
										药品规格
									</td>
								</tr>
							</table>
						</div>
						<!--列表输出各行数据-->
						<div id="tabLines">
							<table width="100%" class="table01" align="center"
								cellspacing="0"
								style="TABLE-LAYOUT: fixed; word-break: break-all">
								<tbody id="__list">
									<c:forEach items="${drugList.statisticsList}" var="s" varStatus="i">
										<tr <c:if test="${i.index%2==0}"> class = 'tr_1'</c:if>
											<c:if test="${i.index%2==1}"> class = 'tr_2'</c:if>>
											<td width="5%" scope="col">
												<input name='enplrpcds' type='checkbox'
													value="${ s.drugid }" />
											</td>
											<td width="15%">
												${s.drugname}
											</td>
											<td width="15%">
												${s.code}
											</td>
											<td width="15%">
												${s.zhuyishixiang}
											</td>
											<td width="15%">
												${s.xingzhuang }
											</td>
											<td width="15%">
												${s.buliangfanying}
											</td>
											<td width="10%">
												${s.yongfayongliang }
											</td>
											<td width="10%">
												${s.specification }
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<!--分页栏-->
				<div id="footer">
					<table width="98%" border="0" cellpadding="0" cellspacing="0"
						align="center">
						<tr>
							<td>
								<label id="_paginationBar">
									${drugList.paginationBar }
								</label>
							</td>
						</tr>
					</table>
				</div>
			</form>
		</div>
		<script language="javascript">
		function reflush( pageNum )
		{
			$.ajax({
		        "url": "${pageContext.request.contextPath}/drugUI/controller/drug.query.action",
		        "data": 
		        { 
		        	"pageNum": pageNum,
		        	"drugname":window.encodeURI(document.getElementById("drugname").value),
		        	"drugid":window.encodeURI(document.getElementById("drugid").value),
		        	"typeid":document.getElementById("typeid").value,
		        	"code":window.encodeURI(document.getElementById("code").value)
		        },
		        "dataType": "json",
		        "type": "POST",
		        "success": function( obj )
		        { 	
					$("#__list").empty();
					if(obj!=null)
					{
					$.each(obj.statisticsList, function(index, s){
							var trObj = $("<tr></tr>");
							trObj.attr("align","center");  
		                    $("<td  width=\"5%\"></td>").html( "<input type=\"checkbox\" name=\"enplrpcds\" value='"+ s.drugid +"' />").appendTo(trObj);    
		                    $("<td  width=\"15%\"></td>").html(s.drugname).appendTo(trObj);
		                    $("<td  width=\"15%\"></td>").html(s.code).appendTo(trObj); 
		                    $("<td  width=\"15%\"></td>").html(s.zhuyishixiang ).appendTo(trObj);
		                    $("<td  width=\"15%\"></td>").html(s.xingzhuang).appendTo(trObj);
		                    $("<td  width=\"15%\"></td>").html(s.buliangfanying).appendTo(trObj);
		                    $("<td  width=\"10%\"></td>").html(s.yongfayongliang).appendTo(trObj);
		                    $("<td  width=\"10%\"></td>").html(s.specification).appendTo(trObj);
		                    trObj.appendTo($("#__list")); 
		                    $('tbody[id*=__list] > tr:even').addClass('tr_1');
		                    $('tbody[id*=__list] > tr:odd').addClass('tr_2');
		                    $('tbody[id*=__list] > tr[id!=totalRow]').mouseover(function(){$(this).removeClass();$(this).addClass('tr_0');})
		                    $('tbody[id*=__list] > tr[id!=totalRow]:even').mouseout(function(){$(this).addClass('tr_1');})
		                    $('tbody[id*=__list] > tr[id!=totalRow]:odd').mouseout(function(){$(this).addClass('tr_2');})
		            });
		            $("#_paginationBar").html(obj.paginationBar);
					}
		        }
		    });
		}
		function generateRecipe(){
		var pprcd = getCheckBoxValues("enplrpcds");
			if ( pprcd == "")
			{
				alert( "请选择药品!" );
				return false;
			}
			var url = "${pageContext.request.contextPath}/drugUI/controller/drug.check.action?drugids="+planId;
			modelWindow(url,1040,300);
		}
		window.onload = function(){resizeTabBody( 'tabLines' )};
		window.onresize = function(){resizeTabBody( 'tabLines' )};
	</script>
	</body>
</html>
<%@ include file="/drugUI/common/footer.jsp"%>